function myFlag(arr) {
    // 采用reduce的遍历方式
	let res = arr.reduce((pre, next) => {
		return pre.concat(Array.isArray(next) ? myFlag(next) : next);
	}, []);
	return res;
}
console.log(myFlag([1, 2, 3, [1, 2, 3, [1, 2, 3]]])); // [1, 2, 3, 1, 2, 3, 1, 2, 3]
